package cn.schoolwow.quickflow.domain;

import cn.schoolwow.quickflow.dto.FlowContextDataRange;

import java.util.Arrays;

public class InstanceData {
    public FlowContextDataOption flowContextDataOption = new FlowContextDataOption();

    public static InstanceData newInstance(Object instance){
        InstanceData instanceData = new InstanceData();
        instanceData.flowContextDataOption.value = instance;
        instanceData.flowContextDataOption.key = instance.getClass().getName();
        instanceData.flowContextDataOption.flowContextDataRange = FlowContextDataRange.Flow;
        return instanceData;
    }

    public InstanceData classType(Class classType){
        flowContextDataOption.key = classType.getName();
        return this;
    }

    public InstanceData flowContextDataRange(FlowContextDataRange flowContextDataRange){
        flowContextDataOption.flowContextDataRange = flowContextDataRange;
        return this;
    }

    public InstanceData flowDataFeature(FlowDataFeature... flowDataFeatures){
        flowContextDataOption.flowDataFeatureList.addAll(Arrays.asList(flowDataFeatures));
        return this;
    }

}
